home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- *
- * CopyrightVersion 1.1_pre-beta
- */
-
- package examples.hello;
-
- import java.rmi.*;
- import java.rmi.server.UnicastRemoteObject;
-
- public class HelloImpl
- extends UnicastRemoteObject
- implements Hello
- {
- private String name;
-
- public HelloImpl(String s) throws java.rmi.RemoteException {
- super();
- name = s;
- }
-
- public String sayHello() throws RemoteException {
- return "Hello World!";
- }
-
- public static void main(String args[])
- {
- // Create and install the security manager
- System.setSecurityManager(new RMISecurityManager());
-
- try {
- HelloImpl obj = new HelloImpl("HelloServer");
- Naming.rebind("HelloServer", obj);
- System.out.println("HelloImpl created and bound in the registry to the name HelloServer");
-
- } catch (Exception e) {
- System.out.println("HelloImpl.main: an exception occurred:");
- e.printStackTrace();
- }
- }
- }
-